import './index.less';
class Animal {
    constructor(name) {
        this.name = name
    }
    getName() {
        return this.name
    }
}
const dog = new Animal('dog')
console.log(dog.name)
console.log('222')
console.log('333')

if(module && module.hot) {
    module.hot.accept()
}

// 发起跨域请求
fetch("/api/user")
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(err => console.log(err));

// 简单获取数据
fetch("user?v=1")
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(err => console.log(err));

// 使用mock获取数据
    fetch("/login/account", {
    method: "POST",
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        username: "admin",
        password: "888888"
    })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(err => console.log(err));
